﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PPTHelper.BLL
{
    public class UnitBase 
    {
        /// <summary>
        ///     获取单位数值。
        /// </summary>
        virtual public double Value { get; }

        public static implicit operator double(UnitBase unit)
        {
            return unit.Value;
        }

        public UnitBase(double value)
        {
            Value = value;
        }

        public static readonly UnitBase Zero = new UnitBase(0);
    }


    /// <summary>
    ///     英制公制单位（English Metric Unit）。用于对接厘米（<see cref="Cm" />）和英寸（<see cref="Inch" />）的虚拟单位。
    ///     <para>其特殊的数值设计，便于让你在转换百位以内的英寸和毫米、像素长度时，不会产生小数。</para>
    ///     <para>1 <see cref="Inch" /> = 914400 <see cref="Emu" /></para>
    /// </summary>
    public class Emu : UnitBase
    {
        /// <summary>
        ///     创建 <see cref="Emu" /> 单位。
        /// </summary>
        /// <param name="value"><see cref="Emu" /> 单位数值。</param>
        public Emu(double value) : base(value)
        {
        }
 
    }

    /// <summary>
    /// 厘米 Centimeters = Inches*2.54
    /// </summary>
    public class Cm : UnitBase
    {
        public Cm(double value) : base(value)
        {
        }
    }

    /// <summary>
    /// Dxa是什么单位我也不清楚，后续再补
    /// </summary>
    public class Dxa : UnitBase
    {
        public Dxa(double value) : base(value)
        {
        }
    }

    /// <summary>
    /// 表示百分比相对值，用于表示表格的宽度和相对宽度
    /// </summary>
    public class FiftiethsOfAPercent : UnitBase
    {
        public FiftiethsOfAPercent(double value) : base(value)
        {
        }
    }

    /// <summary>
    /// 用来表示字体大小的半点，一个点等于两个半点
    /// </summary>
    public class HalfPoint : UnitBase
    {
        public HalfPoint(double value) : base(value)
        {
        }
    }

    /// <summary>
    /// 英寸 Inches = Points/72 <see cref="Pt"/>
    /// </summary>
    public class Inch : UnitBase
    {
        public Inch(double value) : base(value)
        {
        }
    }

    /// <summary>
    /// 毫米
    /// </summary>
    public class Mm : UnitBase
    {
        public Mm(double value) : base(value)
        {
        }
    }

    public class Pixel : UnitBase
    {
        public Pixel(double value) : base(value)
        {
        }
    }

    /// <summary>
    /// 像素 Points = dxa/20 <see cref="Dxa"/>
    /// </summary>
    public class Pt : UnitBase
    {
        public Pt(double value) : base(value)
        {
        }
    }
}
